﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using LibService.DTO;

namespace LibService.DAO
{
    public class TinhThanhDAO
    {
        #region 1. Lay Danh Sach Thong Tin Tinh Thanh
        public static List<TinhThanhDTO> layDanhSachTinhThanh()
        {
            List<TinhThanhDTO> lst = new List<TinhThanhDTO>();
            try
            {
                SQLConnect cnn = new SQLConnect();
                DataTable dt = new DataTable();
                dt = cnn.ExecuteQuery("sp_layThongTinTinhThanh", CommandType.StoredProcedure);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TinhThanhDTO tt = new TinhThanhDTO();
                    tt.MaTinhThanh = dt.Rows[i]["MaTinhThanh"].ToString();
                    tt.TenTinhThanh = dt.Rows[i]["TenTinhThanh"].ToString();
                    lst.Add(tt);
                }
            }
            catch (Exception ex)
            {

            }
            return lst;
        }
        #endregion
    }
}